
**** Table H.5 
use "$datadir\ewallet\maindata.dta", clear	

	bys time_id: egen exposure_5 = xtile(invshare_sd), nq(5)

	xtset district_id time_id 
	foreach var in logamount lognewfirms  {
		cap drop r_`var'
		reghdfe `var' , a(district_id time_id $controls#i.time_id) residuals(r_`var')
	}
	
	forval i=2/5{
		g postXexposure`i' = post*(exposure_5 == `i')
	}
	 
	reghdfe  logamount postXexposure2-postXexposure5 post if $filters, a($fe $controls##i.time_id) cluster(district_id)
	outreg2 using "$outputdir_tab\Table_H_5", tex(frag) ctitle("log(amount)") dec(3) bracket label addtext(District Controls $\times$ Month f.e., $\checkmark$) nocons nonotes stats(coef se)  replace
	reghdfe  lognumfirms postXexposure2-postXexposure5 post if $filters, a($fe $controls##i.time_id) cluster(district_id)
	outreg2 using "$outputdir_tab\Table_H_5", tex(frag) ctitle("log(users)") dec(3) bracket label addtext(District Controls $\times$ Month f.e., $\checkmark$) nocons nonotes stats(coef se)  append
	reghdfe  lognewfirms postXexposure2-postXexposure5 post if $filters, a($fe $controls##i.time_id) cluster(district_id)
	outreg2 using "$outputdir_tab\Table_H_5", tex(frag) ctitle("log(switchers)") dec(3) bracket label addtext(District Controls $\times$ Month f.e., $\checkmark$) nocons nonotes stats(coef se)  append
